// 将TestVarible test_variable TEST_VARIABLE 转为testVariable
function format(name) {
  let len = name.length;
  if (len === 0) {
    return '';
  }
  let hasUnderLine = false;
  for (let i = 0; i < len; i++) {
    if (name[i] === '_') {
      hasUnderLine = true;
      break;
    }
  }
  if (hasUnderLine) {
    const arr = name.split('_');
    for (let i = 0; i < arr.length; i++) {
      arr[i] = arr[i].toLowerCase();
    }
    return arr.join('');

  } else {
    let f = name[0].toLowerCase();
    return f + str.slice(1);
  }
}

console.log(format(TestVarible));
console.log(format(test_variable));
console.log(format(TEST_VARIABLE));